package com.clickpaas.materialsprocurement.controller;

import com.clickpaas.materialsprocurement.annotation.ControllerLog;
import com.clickpaas.materialsprocurement.common.Response.ResponseResult;
import com.clickpaas.materialsprocurement.entity.MaterialsEntity;
import com.clickpaas.materialsprocurement.entity.PurchaseOrderEntity;
import com.clickpaas.materialsprocurement.entity.ReqLineEntity;
import com.clickpaas.materialsprocurement.entity.SupplierInformationEntity;
import com.clickpaas.materialsprocurement.service.ControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(description = "数据查询")
@RestController
@RequestMapping(value = "/query")
public class QueryMaterialShopCartController {
    @Resource
    ControllerService controllerService;

    @ApiOperation("查询请购单物料信息")
    @PostMapping(value = "/reqLineMaterial")
    @ControllerLog
    public ResponseResult getReqLineMaterialsInfo(@ApiParam(value = "MaterialsEntity")@RequestBody MaterialsEntity materialsEntity){
        return controllerService.getReqLineMaterialsInfo(materialsEntity);
    }

    @ApiOperation("查询物料列表")
    @PostMapping(value = "/Material")
    @ControllerLog
    public ResponseResult getMaterialsInfo(){
        return controllerService.getMaterialsInfo();
    }

    @ApiOperation("查询共享库存和对应的物料数据")
    @PostMapping(value = "/SharedInventory")
    @ControllerLog
    public ResponseResult getSharedInventoryInfo(@ApiParam(value = "MaterialsEntity")@RequestBody MaterialsEntity materialsEntity){
        return controllerService.getSharedInventoryInfo(materialsEntity);
    }

    @ApiOperation("查询请购单行和询价单信息")
    @PostMapping(value = "/reqRFQInfo")
    @ControllerLog
    public ResponseResult getReqRFQInfo(@ApiParam(value = "ReqLineEntity")@RequestBody ReqLineEntity reqLineEntity){
        return controllerService.getreqRFQInfo(reqLineEntity);
    }

    @ApiOperation("查询供应商对象数据信息")
    @PostMapping(value = "/supplierInfo")
    @ControllerLog
    public ResponseResult getSupplierInfo(@ApiParam(value = "SupplierInformationEntity")@RequestBody SupplierInformationEntity supplierInformationEntity){
        return controllerService.getSupplierInfo(supplierInformationEntity);
    }

    @ApiOperation("查询采购订单行对象数据信息")
    @PostMapping(value = "/purchaseLineInfo")
    @ControllerLog
    public ResponseResult getPurchaseLineInfo(@ApiParam(value = "PurchaseOrderLineEntity")@RequestBody PurchaseOrderEntity purchaseOrderEntity){
        return controllerService.getPurchaseLineInfo(purchaseOrderEntity);
    }
}
